.TH std::ranges::cartesian_product_view::end 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::ranges::cartesian_product_view::end \- std::ranges::cartesian_product_view::end

.SH Synopsis
   constexpr iterator<false> end()

       requires ((!__simple_view<First> || ... || !__simple_view<Vs>) \fB(1)\fP (since C++23)
   &&

           __cartesian_product_is_common<First, Vs...>);
   constexpr iterator<true> end() const
       requires __cartesian_product_is_common<const First, const      \fB(2)\fP (since C++23)
   Vs...>;
   constexpr std::default_sentinel_t end() const noexcept;            \fB(3)\fP (since C++23)

   Returns an iterator or a sentinel representing the end of the
   cartesian_product_view.

   Let bases_ be the underlying tuple of views.

   1,2) Let:
     * __is_const be true for the const-qualified overload, and false otherwise;
     * __is_empty be true if the expression ranges::empty(rng) is true for any rng
       among the underlying ranges except the first one and false otherwise; and
     * __begin_or_first_end(rng) be expression-equivalent to __is_empty ?
       ranges::begin(rng) : __cartesian_common_arg_end(rng) if rng is the first
       underlying range and ranges::begin(rng) otherwise.

   Equivalent to:

 auto check = [](auto& rng) { return __begin_or_first_end(rng); };
 return iterator<__is_const>(__tuple_transform(check, bases_));

   3) Equivalent to: return std::default_sentinel;.

.SH Parameters

   \fI(none)\fP

.SH Return value

   An iterator to the element following the last element, or a sentinel which compares
   equal to the end iterator.

.SH Example


// Run this code

 #include <array>
 #include <format>
 #include <iostream>
 #include <ranges>
 #include <string_view>
 #include <tuple>
 using namespace std::literals;

 int main()
 {
     constexpr auto a = std::array{ "bool"sv, "goto"sv, "extern"sv, "long"sv }; /*
                                        ^         ^           ^         ^        */
     constexpr auto v = std::ranges::cartesian_product_view(a[0], a[1], a[2], a[3]);

     constexpr std::tuple<char const&,
                          char const&,
                          char const&,
                          char const&> last{*(v.end() - 1)};

     std::cout << std::format("{}{}{}{}{}",
                              std::get<0>(last),
                              std::get<1>(last),
                              std::get<2>(last),
                              std::get<3>(last), '\\n');
 }

.SH Output:

 long

.SH See also

   begin       returns an iterator to the beginning
   (C++23)     \fI(public member function)\fP
   ranges::end returns a sentinel indicating the end of a range
   (C++20)     (customization point object)
